package com.ai.web.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ai.web.service.CompanyProfileService;
import com.ai.web.vo.CompanyProfileV;
import com.ai.web.vo.ResultModel;
import com.tiny.persistence.domain.CompanyProfile;
import com.tiny.persistence.repository.CompanyProfileRepo;

@Service
public class CompanyProfileServiceImpl extends BaseServiceImpl<CompanyProfile, Integer, CompanyProfileV> implements CompanyProfileService  {

    @Autowired
    private CompanyProfileRepo companyProfileRepo;
    
    @Autowired
    public CompanyProfileServiceImpl(CompanyProfileRepo companyProfileRepo) {
        super(companyProfileRepo);
    }

    public CompanyProfileV getCompanyProfile(int userId) throws Exception {
        return getT(userId);
    }

    public ResultModel saveCompanyProfile(CompanyProfileV companyProfileV) throws Exception {
        
        CompanyProfileV saveV = saveT(companyProfileV);
        
        ResultModel rm = new ResultModel();
        rm.setData(saveV);
        rm.setSuccessCode();
        
        return rm;
    }

    public ResultModel deleteCompanyProfiles(List<Integer> userIds) throws Exception {
        deleteTs(userIds);
        
        ResultModel rm = new ResultModel();
        rm.setSuccessCode();
        rm.setMsg("删除成功！");
        
        return rm;
    }

	public CompanyProfile getCompany() throws Exception {
		return companyProfileRepo.getCompany();
	}

}
